import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../interface/root_proxy_model.dart';
import 'user_list_admin_page_model.dart';

class UserListAdminPage extends StatelessWidget {
  const UserListAdminPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
        providers: [
          ChangeNotifierProxyProvider<RootProxyModel, UserListPageAdminModel>(
            create: (context) => UserListPageAdminModel(),
            update: (context, rootProxyModel, leafModel) {
              if (leafModel == null) throw ArgumentError.notNull('leafModel');
              leafModel.roomModel = rootProxyModel;
              return leafModel;
            },
          ),
        ],
        child:
            Consumer<UserListPageAdminModel>(builder: (context, model, child) {
          return Column(
            children: [
              const SizedBox(
                height: 10,
              ),
              Container(
                color: Colors.red,
                child: const Text(" ListView.builder"),
              ),
              // Expanded(
              //   child: ListView.builder(
              //       itemCount: model.data?.users.length ?? 0,
              //       itemBuilder: (context, index) {
              //         return UserListItemAdminWidget(
              //           user: model.data!.users[index],
              //           myRole: model.roomModel.channel?.role,
              //           index: index + 1,
              //           onPressed: () {
              //             model.onItemPressed(
              //                 context, model.data!.users[index]);
              //           },
              //           onPressedRightBtn: () {
              //             model.cancelAdmin(
              //                 model.data!.users[index].id, RtcUserRole.Guest);
              //           },
              //         );
              //       }),
              // ),
            ],
          );
        }));
  }
}
